Socket
Socket
Sign inDemoInstall

ethjs-util

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethjs-util

A simple set of Ethereum JS utilties.


Version published
Weekly downloads
373K
increased by0.15%
Maintainers
1
Weekly downloads
 
Created

What is ethjs-util?

The ethjs-util package provides a collection of utility functions for Ethereum-related operations. These utilities include functions for handling hex strings, checking types, and manipulating buffers, among others.

What are ethjs-util's main functionalities?

Hex String Conversion

This feature allows you to convert a buffer to a hex string. The code sample demonstrates converting the string 'hello' into its hex representation.

const ethUtil = require('ethjs-util');
const hexString = ethUtil.bufferToHex(Buffer.from('hello', 'utf8'));
console.log(hexString); // '0x68656c6c6f'

Type Checking

This feature provides functions to check if a given string is a valid hex string. The code sample checks if '0x68656c6c6f' is a hex string.

const ethUtil = require('ethjs-util');
const isHex = ethUtil.isHexString('0x68656c6c6f');
console.log(isHex); // true

Buffer Manipulation

This feature includes functions for manipulating buffers, such as setting their length. The code sample demonstrates padding a buffer to a specified length.

const ethUtil = require('ethjs-util');
const buffer = ethUtil.setLengthLeft(Buffer.from('1234', 'utf8'), 10);
console.log(buffer); // <Buffer 00 00 00 00 00 00 31 32 33 34>

Other packages similar to ethjs-util

Keywords

FAQs

Package last updated on 10 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc